//
//  ZWHTeaViewCell.swift
//  约麻
//
//  Created by Syrena on 2017/7/19.
//  Copyright © 2017年 Sweet. All rights reserved.
//

import UIKit

class ZWHTeaViewCell: UITableViewCell {
    
    @IBOutlet weak var nameL: UILabel!

    @IBOutlet weak var introL: UILabel!
    
    @IBOutlet weak var distanceL: UILabel!
    
    var model:ZWHTeaViewModel?{
        didSet{
            nameL.text = model?.tea.name
            introL.text = model?.tea.address
            let distance = Float((model?.distance)!) / 1000
            distanceL.text = String.init(format: "%.2fkm", distance)
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    @IBAction func callClicked(_ sender: UIButton) {
        ZWHCALL.shard.loadRequest(URLRequest(url: URL(string:"tel://"+(model?.tea.phone)!)!))
    }
}
